<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box{
            width: 100px;
            height: 100px;
            background: red;
        }
    </style>
</head>
<body>
    <button id="btn1">按钮1</button>
    <button id="btn2">按钮2</button>
    <div id="box"></div>

    <script>
        var btn1 = document.getElementById('btn1');
        var btn2 = document.getElementById('btn2');
        var box = document.getElementById('box');

        // btn1.onclick = function(){
        //     box.style.width = '200px';
        //     box.style.height = '200px';
        // }
        // btn2.onclick = function(){
        //     box.style.width = '200px';
        //     box.style.height = '200px';
        // }


        btn1.onclick = fn;
        btn2.onclick = fn;



        function fn(){
            box.style.width = '200px';
            box.style.height = '200px';
        }
    </script>
</body>
</html>